package com.stone.action;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.stone.model.Admin;
import com.stone.model.Photo;
import com.stone.model.Provider;
import com.stone.model.Stone;
import com.stone.service.ILoggerService;
import com.stone.service.IStoneService;
import com.stone.serviceimpl.LoggerService;
import com.stone.utils.ImageUtils;
import com.stone.utils.LogConstrants;
import com.stone.utils.Page;

public class StoneAdminAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private IStoneService stoneService;
	private ILoggerService logService = new LoggerService();
	
	private long stoneId;
	private String chineseName;
	private String englishName;
	private String sourceland;
	private String material;
	private String venation;
	private String color;
	private String stoneWA;
	private String stoneBD;
	private String stoneSH;
	private String stoneMR;
	private String stoneCS;
	private Float minprice;
	private Float maxprice;
	private String level;
	private String purpose;
	private String successfulCase;
	private String description;
	private String shortDesc;
	private long defaultPhotoId;
	
	private String stoneName;//笼统的一个名字，用于名字查询时使用
	private boolean hrefFlag = false;//是否通过URL 查询
	
	private File file;
	private String fileFileName;
	private String fileContentType;
	private String message = "你已成功上传文件";
	private String fileName; 
	
	private Stone stone;
	private String error;
	private List<Photo>	photos = new ArrayList();
	private long photoId;
	private String photoDesc;
	private String photoUrl;
	
	private int pageno;
	private int pagesize = 20;
	private Page page;
	private int flag = 1;
	
	private List<Stone> list;
	private int listSize;
	
	private List<Integer> completeList;
	
	private static Logger logger = Logger.getLogger("石材");
	
	private String displayFlag;
	/**
	 * 增加石材
	 * @return
	 */
	public String addStone(){
		photos.clear();
		this.stone = new Stone();
		stone.setChineseName(chineseName);
		stone.setEnglishName(englishName);
		stone.setSourceland(sourceland);
		stone.setMaterial(material);
		stone.setVenation(venation);
		stone.setColor(color);
		stone.setStoneWA(stoneWA);
		stone.setStoneBD(stoneBD);
		stone.setStoneSH(stoneSH);
		stone.setStoneMR(stoneMR);
		stone.setStoneCS(stoneCS);
		stone.setMinprice(minprice);
		stone.setMaxprice(maxprice);
		stone.setLevel(level);
		stone.setPurpose(purpose);
		stone.setSuccessfulCase(successfulCase);
		stoneService.addStone(stone);
		
		HttpSession session = ServletActionContext.getRequest().getSession();
		List<MyImage> images = (List<MyImage>)session.getAttribute("StoneImages");
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
		try {
			for(int i=0;i<images.size();i++){
				MyImage img = images.get(i);
				this.saveImage(img.getBuff(), 560, img.getExtention(), img.getImageName());
				this.saveImage(img.getBuff(), 160, img.getExtention(), img.getImageName());
				this.saveImage(img.getBuff(), 120, img.getExtention(), img.getImageName());
				this.saveImage(img.getBuff(), 70, img.getExtention(), img.getImageName());
				String dataString = formatter.format(img.getImageName());	
				Photo pho = new Photo();
				pho.setUrl(dataString+"/"+img.getImageName()+"."+img.getExtention());
				pho.setName(img.getUploadName());
				if(i==0){
					pho.setDefaultPhoto("1");
					stone.setDefaultPhoto(pho.getUrl());
					Date data = new Date(System.currentTimeMillis());
					stone.setStartTime(data);
					stoneService.updateStone(stone);
				}else{
					pho.setDefaultPhoto("0");
				}
				pho.setStone(stone);
				stoneService.addStonePhoto(pho);
				this.photos.add(pho);
			}
			session.removeAttribute("StoneImages");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			this.error = "保存图片失败，请稍候再试";
			session.removeAttribute("StoneImages");
			e.printStackTrace();
			return "input";
		}
		
		Map<String, Object> session1 = ActionContext.getContext().getSession();
		logger.fatal(((Admin)session1.get("admin")).getUsername()+"添加了石材: " +stone.getChineseName());
		
		logService.log(((Admin)session1.get("admin")).getUsername(), "添加了石材: " +stone.getChineseName(), LogConstrants.STONE_ADD);
		
		return "success";
	}
	
	public String saveDescription(){
		Stone s = stoneService.findStoneById(stoneId);
		s.setDescription(stone.getDescription());
		s.setShortDesc(this.shortDesc);
		Date data = new Date(System.currentTimeMillis());
		s.setStartTime(data);
		stoneService.updateStone(s);
		stoneService.createNewIndex(ServletActionContext.getRequest().getRealPath(""));
		
		Map<String, Object> session = ActionContext.getContext().getSession();
		logger.fatal(((Admin)session.get("admin")).getUsername()+"更新了石材: "+s.getChineseName());
		
		logService.log(((Admin)session.get("admin")).getUsername(), "更新了石材: " +s.getChineseName(), LogConstrants.STONE_UPDATE);
		
		return "success";
	}
	
	public String modifyStoneBase(){
		if(this.flag==1)
		{
			Date data = new Date(System.currentTimeMillis());
			this.stone.setStartTime(data);
			stoneService.updateStone( this.stone );
			stoneService.createNewIndex(ServletActionContext.getRequest().getRealPath(""));
			Map<String, Object> session = ActionContext.getContext().getSession();
			logger.fatal(((Admin)session.get("admin")).getUsername()+"更新了石材: "+stone.getChineseName());
			logService.log(((Admin)session.get("admin")).getUsername(), "更新了石材: " +stone.getChineseName(), LogConstrants.STONE_UPDATE);
			this.stoneId = this.stone.getId();
		}
		this.photos = this.stoneService.findPhotosByStoneId(this.stoneId);
		return "success";
	}
	
	public String toEditStone(){
		this.stone = this.stoneService.findStoneById(stoneId);
		return "success";
	}
	
	
	/**
	 * @author Libz
	 * 调用 返回 所满足名字条件的石头列表
	 * @return
	 */
	public String toStoneList(){
		if(hrefFlag){
			try {
				stoneName = new String(ServletActionContext.getRequest().getParameter("stoneName").getBytes("ISO-8859-1"),"UTF-8");
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}
		if(stoneName != null && !stoneName.equals("")){
			page = stoneService.findStonePageByName(stoneName , pageno ,20);
		}else{
			this.page = this.stoneService.getStoneList(this.pageno,20);
		}
		completeList=new ArrayList<Integer>();
		for(int i = 0 ; i < page.getList().size(); i ++ )
		{
			Stone stone = (Stone)page.getList().get(i);
			int complete = CalculateCompleteness(stone);
			completeList.add(complete);
		}
		
		return "success";
	}
	
	private Integer CalculateCompleteness(Stone stone) {
		float fz = 0;
		float fm = 0;
		if(stone.getChineseName()!=null&&!stone.getChineseName().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getColor()!=null&&!stone.getColor().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getEnglishName()!=null&&!stone.getEnglishName().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getSourceland()!=null&&!stone.getSourceland().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getStoneWA()!=null&&!stone.getStoneWA().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getStoneBD()!=null&&!stone.getStoneBD().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getStoneCS()!=null&&!stone.getStoneCS().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getStoneMR()!=null&&!stone.getStoneMR().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getStoneSH()!=null&&!stone.getStoneSH().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getVenation()!=null&&!stone.getVenation().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getLevel()!=null&&!stone.getLevel().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getMaterial()!=null&&!stone.getMaterial().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getMaxprice()!=null)
		{fz++;fm++;}
		else
			fm++;
		if(stone.getMinprice()!=null)
		{fz++;fm++;}
		else
			fm++;
		if(stone.getSuccessfulCase()!=null&&!stone.getSuccessfulCase().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getPurpose()!=null&&!stone.getPurpose().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getShortDesc()!=null&&!stone.getShortDesc().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getDescription()!=null&&!stone.getDescription().equals(""))
		{fz++;fm++;}
		else
			fm++;
		if(stone.getPhotos()!=null&&!stone.getPhotos().isEmpty())
		{fz++;fm++;}
		else
			fm++;
		return (int) (fz*100/fm);
	}

	/**
	 * @author Libz
	 * AJAX 调用 返回一个page Bean 类
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public String findStoneListAjax(){
		if(stoneName != null && !stoneName.equals("")){
			page = stoneService.findStonePageByName(stoneName , pageno ,pagesize);
		}else{
			this.page = this.stoneService.getStoneList(this.pageno,pagesize);
		}
		list = page.getList();
		listSize = list.size();
		return "success";
	}
	
	public String submitDisplay(){
		Stone s = stoneService.findStoneById(stoneId);
		if(displayFlag.equals("yes"))
		{
			s.setDisplayFlag(new Integer(1));
			//System.out.println("111111111");
		}
		else if(displayFlag.equals("no"))
		{
			s.setDisplayFlag(new Integer(0));
			//System.out.println("000000000");
		}
		stoneService.updateStone(s);
		return SUCCESS;
	}
	
	public String deleteStone(){
		Stone s = this.stoneService.findStoneById(stoneId);
		this.stoneService.deleteStone(s);
		stoneService.createNewIndex(ServletActionContext.getRequest().getRealPath(""));
		Map<String, Object> session = ActionContext.getContext().getSession();
		logger.fatal(((Admin)session.get("admin")).getUsername()+"删除了石材： "+s.getChineseName());
		//logService.log(((Admin)session.get("admin")).getUsername(), "删除了石材: " +s.getChineseName(), LogConstrants.STONE_UPDATE);
		return "success";
	}
	
	public String savePhotoDesc(){
		Photo p = stoneService.findPhotosById(photoId);
		p.setDescription(this.photoDesc);
		stoneService.updatePhoto(p);
		return "success";
	}
	public String setDefaultPhoto(){
		Stone s= stoneService.findStoneById(stoneId);
		s.setDefaultPhoto(this.photoUrl);
		List<Photo> ps = this.stoneService.findPhotosByStoneId(stoneId);
		for(Photo p : ps){
			if(p.getUrl().equals(this.photoUrl)){
				p.setDefaultPhoto("1");
				stoneService.updatePhoto(p);
			}else if(p.getDefaultPhoto().equals("1")){
				p.setDefaultPhoto("0");
				stoneService.updatePhoto(p);
			}
		}
		Date data = new Date(System.currentTimeMillis());
		s.setStartTime(data);
		stoneService.updateStone(s);
		return "success";
	}
	//得到图片的后缀
	private static String getExtention(String fileName) {
		int pos = fileName.lastIndexOf(".")+1;
		return fileName.substring(pos);
	}
	public String uploadImage() {
		HttpSession session = ServletActionContext.getRequest().getSession();
		if(session.getAttribute("StoneImages")==null){;
			session.setAttribute("StoneImages", new ArrayList<MyImage>());
		}      
        Image src;
		try {
			src = javax.imageio.ImageIO.read(file);
			int wideths=src.getWidth(null); //得到源图宽
	        int heights=src.getHeight(null); //得到源图长
	        BufferedImage buff = new BufferedImage(wideths,heights,BufferedImage.TYPE_INT_RGB);
	        buff.getGraphics().drawImage(src,0,0,wideths,heights,null); 
	        int buffW = buff.getWidth();
	        int buffH = buff.getHeight();
	        if(buffW<560 || buffH<560){
	        	return "input";
	        }
	        long fn = System.currentTimeMillis();
			String extention = this.getExtention(this.fileFileName);
			
			//计算宽高
			int height,width;
			if(buffW<buffH){	
		        height = buffH*560/buffW;
		        width = 560;
			}else{
		        width = buffW*560/buffH;
		        height = 560; 
			}
	
	        BufferedImage   target   =   new   BufferedImage(560,560,BufferedImage.TYPE_INT_RGB);   
	        target.getGraphics().drawImage(buff,0,0,width,height,null); 
	        
	        buff=target;
	        buff = ImageUtils.cut(buff, 0, 0, 560, 560);   
	        MyImage myImages = new MyImage();
	        myImages.setBuff(buff);
	        myImages.setImageName(fn);
	        myImages.setExtention(extention);
	        myImages.setUploadName(this.fileFileName);
	        ((List<MyImage>)session.getAttribute("StoneImages")).add(myImages);
	        
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} //构造Image对象
        
		return "success";
	}
	private void saveImage(BufferedImage buff,int width, String extention,long fn) throws Exception {
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
		String dataString = formatter.format(fn);	
		String fileName = fn+"";
		String root = ServletActionContext.getRequest().getRealPath("/upload/stone/"+width+"/"+dataString+"/"+fileName+"."+extention);
		buff = ImageUtils.scale2(buff, width, width, true);
		File f = new File(root);
		if(!f.getParentFile().exists()){
        	f.getParentFile().mkdirs();
        }
		ImageIO.write(buff, extention, f);
	}
	
	public String ajaxFileUpload(){
        try {
            if(!(this.getFileFileName().endsWith(".png")||this.getFileFileName().endsWith(".PNG")||this.getFileFileName().endsWith(".jpg")||this.getFileFileName().endsWith(".JPG")||this.getFileFileName().endsWith(".GIF")||this.getFileFileName().endsWith(".gif"))){
            	error="对不起,你上传的文件格式不允许!!!";
                return "error";
            }
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
            Image src;
            src = javax.imageio.ImageIO.read(file);
			int wideths=src.getWidth(null); //得到源图宽
	        int heights=src.getHeight(null); //得到源图长
	        BufferedImage buff = new BufferedImage(wideths,heights,BufferedImage.TYPE_INT_RGB);
	        buff.getGraphics().drawImage(src,0,0,wideths,heights,null); 
	        int buffW = buff.getWidth();
	        int buffH = buff.getHeight();
	        if(buffW<560 || buffH<560){
	        	error="对不起,图片大小应至少为560*560!!!";
	        	return "error";
	        }
	        long fn = System.currentTimeMillis();
			String extention = this.getExtention(this.fileFileName);
			
			//计算宽高
			int height,width;
			if(buffW<buffH){	
		        height = buffH*560/buffW;
		        width = 560;
			}else{
		        width = buffW*560/buffH;
		        height = 560; 
			}
			BufferedImage   target   =   new   BufferedImage(560,560,BufferedImage.TYPE_INT_RGB);   
	        target.getGraphics().drawImage(buff,0,0,width,height,null); 
	        
	        buff=target;
	        buff = ImageUtils.cut(buff, 0, 0, 560, 560);   
	        MyImage myImages = new MyImage();
	        myImages.setBuff(buff);
	        myImages.setImageName(fn);
	        myImages.setExtention(extention);
	        myImages.setUploadName(this.fileFileName);
	        this.saveImage(myImages.getBuff(), 560, myImages.getExtention(), myImages.getImageName());
			this.saveImage(myImages.getBuff(), 160, myImages.getExtention(), myImages.getImageName());
			this.saveImage(myImages.getBuff(), 120, myImages.getExtention(), myImages.getImageName());
			this.saveImage(myImages.getBuff(), 70, myImages.getExtention(), myImages.getImageName());
			String dataString = formatter.format(myImages.getImageName());	
			Photo pho = new Photo();
			pho.setUrl(dataString+"/"+myImages.getImageName()+"."+myImages.getExtention());
			pho.setName(myImages.getUploadName());
			pho.setDefaultPhoto("0");
			pho.setStone(this.stoneService.findStoneById(this.stoneId));
			if(stoneService.findPhotosByStoneId(this.stoneId).size()==0){
				Stone s  =  this.stoneService.findStoneById(this.stoneId);
				s.setDefaultPhoto(pho.getUrl());
				Date data = new Date(System.currentTimeMillis());
				s.setStartTime(data);
				this.stoneService.updateStone(s);
			}
			stoneService.addStonePhoto(pho);
			this.fileName = pho.getUrl();
			this.photoId = pho.getId();
			this.fileName = pho.getName();
			this.photoUrl  = pho.getUrl();
			this.photoDesc = pho.getDescription();

        } catch (Exception e) {
            e.printStackTrace();
            error = "对不起,文件上传失败了!!!!";
        }
        
		return "success";
	}
	
	public String deletePhoto(){
		Photo p = this.stoneService.findPhotosById(this.photoId);
		this.deleteImage(p);
		if(p.getDefaultPhoto().equals("1")){
			this.stoneService.deletePhoto(p);
			this.stoneService.findPhotosByStoneId(this.stoneId);
			Stone s = this.stoneService.findStoneById(stoneId);
			
			List<Photo> ps = this.stoneService.findPhotosByStoneId(this.stoneId);
			if(ps.size()>0){
				s.setDefaultPhoto(ps.get(0).getUrl());
				ps.get(0).setDefaultPhoto("1");
				this.stoneService.updatePhoto(ps.get(0));
			}
			Date data = new Date(System.currentTimeMillis());
			s.setStartTime(data);
			this.stoneService.updateStone(s);
		}else{
			this.stoneService.deletePhoto(p);
		}
		return "success";
	}
	
	private void deleteImage(Photo p){
		String root1 = ServletActionContext.getRequest().getRealPath("/upload/stone/560/"+p.getUrl());
		String root2 = ServletActionContext.getRequest().getRealPath("/upload/stone/160/"+p.getUrl());
		String root3 = ServletActionContext.getRequest().getRealPath("/upload/stone/120/"+p.getUrl());
		String root4 = ServletActionContext.getRequest().getRealPath("/upload/stone/70/"+p.getUrl());
		File f1 = new File(root1);
		if(f1.exists()){
			f1.delete();
		}
		File f2 = new File(root2);
		if(f2.exists()){
			f2.delete();
		}
		File f3 = new File(root3);
		if(f3.exists()){
			f3.delete();
		}
		File f4 = new File(root4);
		if(f4.exists()){
			f4.delete();
		}
	}
	
	public String checkName(){
		this.flag = stoneService.validateName(this.chineseName);
		return "success";
	}
		
	public String toModifyDesc(){
		this.stone = stoneService.findStoneById(stoneId);
		return "success";
	}
	
	public String modifyStoneDesc(){
		Stone s = stoneService.findStoneById(stoneId);
		Date data = new Date(System.currentTimeMillis());
		s.setStartTime(data);
		s.setShortDesc(shortDesc.trim());
		s.setDescription(this.description);
		stoneService.updateStone(s);
		Map<String, Object> session = ActionContext.getContext().getSession();
		logger.fatal(((Admin)session.get("admin")).getUsername()+"更新了石材: "+s.getChineseName());
		logService.log(((Admin)session.get("admin")).getUsername(), "更新了石材: " +s.getChineseName(), LogConstrants.STONE_UPDATE);
		return "success";
	}
	
	//-------------------------------------------set and get---------------------------
	public File getFile() {
		return file;
	}

	public void setFile(File file) {
		this.file = file;
	}

	public String getFileFileName() {
		return fileFileName;
	}

	public void setFileFileName(String fileFileName) {
		this.fileFileName = fileFileName;
	}

	public String getFileContentType() {
		return fileContentType;
	}

	public void setFileContentType(String fileContentType) {
		this.fileContentType = fileContentType;
	}

	public Stone getStone() {
		return stone;
	}

	public void setStone(Stone stone) {
		this.stone = stone;
	}

	public long getStoneId() {
		return stoneId;
	}

	public void setStoneId(long stoneId) {
		this.stoneId = stoneId;
	}

	public String getPhotoUrl() {
		return photoUrl;
	}

	public void setPhotoUrl(String photoUrl) {
		this.photoUrl = photoUrl;
	}

	public int getPagesize() {
		return pagesize;
	}

	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}

	public IStoneService getStoneService() {
		return stoneService;
	}
	public void setStoneService(IStoneService stoneService) {
		this.stoneService = stoneService;
	}
	public String getChineseName() {
		return chineseName;
	}
	public void setChineseName(String chineseName) {
		this.chineseName = chineseName;
	}
	public String getEnglishName() {
		return englishName;
	}
	public void setEnglishName(String englishName) {
		this.englishName = englishName;
	}
	public String getSourceland() {
		return sourceland;
	}
	public void setSourceland(String sourceland) {
		this.sourceland = sourceland;
	}
	public String getMaterial() {
		return material;
	}
	public void setMaterial(String material) {
		this.material = material;
	}
	public String getVenation() {
		return venation;
	}
	public void setVenation(String venation) {
		this.venation = venation;
	}
	public String getColor() {
		return color;
	}
	public void setColor(String color) {
		this.color = color;
	}
	
	public String getStoneWA() {
		return stoneWA;
	}

	public void setStoneWA(String stoneWA) {
		this.stoneWA = stoneWA;
	}

	public String getStoneBD() {
		return stoneBD;
	}

	public void setStoneBD(String stoneBD) {
		this.stoneBD = stoneBD;
	}

	public String getStoneSH() {
		return stoneSH;
	}

	public void setStoneSH(String stoneSH) {
		this.stoneSH = stoneSH;
	}

	public String getStoneMR() {
		return stoneMR;
	}

	public void setStoneMR(String stoneMR) {
		this.stoneMR = stoneMR;
	}

	public String getStoneCS() {
		return stoneCS;
	}

	public void setStoneCS(String stoneCS) {
		this.stoneCS = stoneCS;
	}

	public Float getMinprice() {
		return minprice;
	}
	public void setMinprice(Float minprice) {
		this.minprice = minprice;
	}
	public Float getMaxprice() {
		return maxprice;
	}
	public void setMaxprice(Float maxprice) {
		this.maxprice = maxprice;
	}
	public String getLevel() {
		return level;
	}
	public void setLevel(String level) {
		this.level = level;
	}
	public String getPurpose() {
		return purpose;
	}
	public void setPurpose(String purpose) {
		this.purpose = purpose;
	}
	public String getSuccessfulCase() {
		return successfulCase;
	}
	public void setSuccessfulCase(String successfulCase) {
		this.successfulCase = successfulCase;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}

	public List<Photo> getPhotos() {
		return photos;
	}

	public void setPhotos(List<Photo> photos) {
		this.photos = photos;
	}

	public String getShortDesc() {
		return shortDesc;
	}

	public void setShortDesc(String shortDesc) {
		this.shortDesc = shortDesc;
	}

	public long getDefaultPhotoId() {
		return defaultPhotoId;
	}

	public void setDefaultPhotoId(long defaultPhotoId) {
		this.defaultPhotoId = defaultPhotoId;
	}

	public long getPhotoId() {
		return photoId;
	}

	public void setPhotoId(long photoId) {
		this.photoId = photoId;
	}

	public String getPhotoDesc() {
		return photoDesc;
	}

	public void setPhotoDesc(String photoDesc) {
		this.photoDesc = photoDesc;
	}


	public int getPageno() {
		return pageno;
	}

	public void setPageno(int pageno) {
		this.pageno = pageno;
	}

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public int getFlag() {
		return flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}


	public String getStoneName() {
		return stoneName;
	}

	public void setStoneName(String stoneName) {
		this.stoneName = stoneName;
	}
	
	public boolean isHrefFlag() {
		return hrefFlag;
	}

	public void setHrefFlag(boolean hrefFlag) {
		this.hrefFlag = hrefFlag;
	}
	
	public List<Stone> getList() {
		return list;
	}

	public void setList(List<Stone> list) {
		this.list = list;
	}
	
	public int getListSize() {
		return listSize;
	}

	public void setListSize(int listSize) {
		this.listSize = listSize;
	}

	public String getDisplayFlag() {
		return displayFlag;
	}

	public void setDisplayFlag(String displayFlag) {
		this.displayFlag = displayFlag;
	}
	
	public List<Integer> getCompleteList() {
		return completeList;
	}

	public void setCompleteList(List<Integer> completeList) {
		this.completeList = completeList;
	}

	//------------------------------------------ inner Class  MyImage--------------------------
	private class MyImage{
		private String extention;
		private long imageName;
		private BufferedImage buff;
		private String uploadName;
		public String getExtention() {
			return extention;
		}
		public void setExtention(String extention) {
			this.extention = extention;
		}
		public long getImageName() {
			return imageName;
		}
		public void setImageName(long imageName) {
			this.imageName = imageName;
		}
		public BufferedImage getBuff() {
			return buff;
		}
		public void setBuff(BufferedImage buff) {
			this.buff = buff;
		}
		public String getUploadName() {
			return uploadName;
		}
		public void setUploadName(String uploadName) {
			this.uploadName = uploadName;
		}
		
	}
}
